// 用户
const login = 'exchange/login'; //login

const reg = 'exchange/email/getEmailVerificationCode'; //reg
const emailCode = 'exchange/email/getEmailVerificationCode'; //邮箱验证码
const vipList = 'exchange/user/getList'; //会员列表
const userType = 'exchange/newsCategory/getListByUserType'; //获取攥稿人可以发送的资讯类别
const getAgentByUser = 'exchange/user/getAgentByUser'; //查询攥稿人为该用户的平台商列表
const logout = 'exchange/logout'; //退出登录
const updateUserById = 'exchange/user/updateUserById'; //修改用户信息
// 资讯
const industry = 'exchange/newsCategory/getListByParentId/1'; //1行业雷达
const market = 'exchange/newsCategory/getListByParentId/2'; //2市场雷达
const activity = 'exchange/newsCategory/getListByParentId/3'; //3行业活动
const square = 'exchange/newsCategory/getListByParentId/4'; //4雷达广场
const columnList = 'exchange/news/getList'; //查询资讯列表
const columnDetail = 'exchange/news/getOneById/'; //获取资讯详情exchange/news/getOneById/{id}
const sendInformation = 'exchange/news/addOne'; //发布资讯POST
const changeInformation = 'exchange/news/updateOne'; //修改资讯POST
const fullSearch = 'exchange/news/fullSearch'; //全站搜索
const getListByUserId = 'exchange/news/getListByUserId'; //获取我发布的资讯列表
const checkCollection = 'exchange/news/checkCollection'; //是否收藏
const checkFabulous = 'exchange/news/checkFabulous'; //是否点赞
const clickFabulous = 'exchange/news/clickFabulous'; //点赞
const clickCollection = 'exchange/news/clickCollection'; //收藏
const getMyFabulousList = 'exchange/news/getMyFabulousList'; //获取我的点赞资讯
const getMyCollectionList = 'exchange/news/getMyCollectionList'; //获取我的收藏资讯
const clickBrowse = 'exchange/news/clickBrowse'; //浏览数增加
const getFirstTopList = 'exchange/news/getFirstTopList'; //查询总首页置顶文章
// 平台商
const setUser = 'exchange/user/setMerchantAgent'; //设置用户为攥稿人
const busList = 'exchange/merchant/getList'; //查询商户列表
const busDetail = 'exchange/merchant/get/'; //查询平台商详情exchange/merchant/get/{id}
const getAgentByMerchant = 'exchange/user/getAgentByMerchant'; //查询平台商的攥稿人
const getListBySort = 'exchange/merchant/getListBySort'; //平台排行
const getMerchantNewList = 'exchange/news/getMerchantNewList'; //查询平台商页面 推荐/平台/资讯-1 查询推荐 1查询平台 2查询资讯
const getListByMerchant = 'exchange/merAccount/getListByMerchant'; //获取平台商的标准账户
const getSupListByMerchant = 'exchange/merchantSup/getSupListByMerchant'; //查询平台商的全球监控
const recommendArticle = 'exchange/news/getRecommendList'; //查询平台商页面中的推荐文章
const updateOneById = 'exchange/merchant/updateOneById'; //修改平台商信息 post
const getMerSupCount = 'exchange/merchantSup/getMerSupCount'; //获取监控国家和平台商总数
// 监控机构
const organization = 'exchange/supervision/getListPage'; //查询监控机构
const supervisionDetail = 'exchange/supervision/get/'; //根据id查询监控机构详情{id}
// 其他 //customer_code 客服二维码地址 hotDynamicTags 热门标签search_hot_class_tags 热门搜索分类标签
const getValueByName = 'exchange/sysConfig/getValueByName';
// 评论
const releaseComment = 'exchange/comment/releaseComment'; //发布评论
const getCommentList = 'exchange/comment/getCommentList'; //查询评论
const getMyCommentList = 'exchange/comment/getMyCommentList'; //查询我的评论
const getCommentReplyList = 'exchange/comment/getCommentReplyList'; //查询评论回复列表
////设置全局ajax
$.ajaxSetup({
    xhrFields: {
        withCredentials: true
    }
});
let apiurl = 'http://47.111.189.118/';

let ops = {};
// 这是promise 的封装 不兼容ie
function Getdata(url,ops,type){ //默认get
    url = apiurl + url; //线上http://47.111.189.118/
    // url = 'http://192.168.2.101:7001/'+url;//线下
    var promiseObj = new Promise(function(resolve, reject) {
        $.ajax({
            type:type,
            url:url,
            data: ops,
            async: false,
            dataTyp: "json",
            headers: {
                "client-token": "PC"
            },
            success: res =>{
                resolve(res);
            },
            error: res => {
                reject(res);
            }
        })
    })
    return promiseObj;
}
// 这是jq的接口封装封装
function getData(url,ops,func){
    type = "get";
    url = apiurl + url;
    $.ajax({
       type: type,
       url:url ,
       dataType: "json",
       data: ops,
       error: function (err) {
           //请求失败时被调用的函数 
           console.log("失败:" + err);
       },
       success: function (res) {
            func(res)
       }
   });
}
